

#define TICK_LENGTH 1 //Tick length in seconds.

#define DAY_LENGTH 3000 //Length in a ingame day, for best results, it should be a multiple of TICK_LENGTH.

#define FOOD_TICK_LENGTH 60 //Time till food is subtracted in ticks.

#define TIME_START 1200 //What value of DAY_LENGTH the game starts at.

var
	day_time = 0

	food_ticks = 0

	time_info = "null"

	grassgenned = 0

proc
	runTime()
		day_time = TIME_START
		spawn while(1)
			/*
			if(day_time == 0 || day_time >= DAY_LENGTH)
				sd_OutsideLight(0)
				day_time = 0
				time_info = "It is midnight."

			if(day_time >= (DAY_LENGTH/6))
				sd_OutsideLight(3)
				time_info = "Dawn is approaching."

			if(day_time >= (2*(DAY_LENGTH/6)))
				sd_OutsideLight(5)
				time_info = "The sun is rising."

			if(day_time >= (3*(DAY_LENGTH/6)))
				sd_OutsideLight(7)
				time_info = "It is midday."

			if(day_time >= (4*(DAY_LENGTH/6)))
				sd_OutsideLight(5)
				time_info = "The sun is beginning to set."

			if(day_time >= (5*(DAY_LENGTH/6)))
				sd_OutsideLight(3)
				time_info = "Its getting late." */

			day_time += TICK_LENGTH


			//GenerateGraph()



			if(food_ticks >= FOOD_TICK_LENGTH)
				food_ticks = 0
				for(var/mob/player/M in world) // I limited hunger to players
					M.LowerHunger()
					M.totalhp = M.CalcTotHP()
					if (M.starving)
						M.Hurt(10, "h", 5)



			else
				food_ticks ++

			/*

			for(var/mob/NPC/M in world) // The old NPC code from ameripain
				M.takeTurn()*/


			sleep(TICK_LENGTH*10)
